#4.work_1
magicians = ['alice', 'david', 'carolina']
for magician in magicians:
    print(magician)

magicians = ['alice', 'david', 'carolina']
for magician in magicians:
    print(f"{magician.title()}, that was a great trick!")

for magician in magicians:
    print(f"{magician.title()}, that was a great trick!")
    print(f"I can't wait to see your next trick, {magician.title()}.\n")
print("Thank you, everyone. That was a great magic show!")

#4.3
for value in range(1, 5):
    print(value)

for value in range(1, 6):
    print(value)

numbers = list(range(1, 6))
print(numbers)

numbers=list(range(6))
print(numbers)

even_numbers = list(range(2, 11, 2))
print(even_numbers)

print(" ")

squares=[]
for aa in range(1,11):
    square=aa**2
    squares.append(square)
print(squares)

hi=[]
for bb in range(1,8):
    hi.append(bb**2)
print(hi)

digits=[1,2,3,4,5,6,7,8,9,0]
print(min(digits))
print(max(digits))
print(sum(digits))

squares = [value**2 for value in range(1, 11)]
print(squares)

print("\n练习4.3-4.9")

for count in range(1,21):
    print(count)

#numbers=list(range(work_1,1000001))
# print(numbers)
#print(min(numbers))
#print(max(numbers))
#print(sum(numbers))

jishu=list(range(1,21,2))
for sange in jishu:
    print(sange)

beishu=list(range(3,31,3))
for sandebeishu in beishu:
    print(sandebeishu)

lifang=[]

for number in range(1,11):
    lifang.append(number**3)
print(lifang)

lifang=[number**3 for number in range(1,11)]
print(lifang)

players = ['charles', 'martina', 'michael', 'florence', 'eli']
print(players[1:4])

print(players[2:])

print(players[-3:])

print(players[2::2])

print("Here are the first three players on my team:")
for player in players[:3]:
    print(player.title())

my_foods = ['pizza', 'falafel', 'carrot cake']
friend_foods = my_foods[:]

print("My favorite foods are:")
print(my_foods)

print("\nMy friend's favorite foods are:")
print(friend_foods)

my_foods = ['pizza', 'falafel', 'carrot cake']
friend_foods = my_foods[:]

my_foods.append('cannoli')
friend_foods.append('ice cream')

print("My favorite foods are:")
print(my_foods)

print("\nMy friend's favorite foods are:")
print(friend_foods)

print("\n练习4.10-4.12")
players = ['charles', 'martina', 'michael', 'florence', 'eli']
print("The first three items in the list are:")
player_1=players[:3]
print(player_1)
print("\nThree items from the middle of the list are:")
players_2=players[1:5]
print(players_2)
print("\nThe last three items in the list are:")
players_3=players[-3:]
print(players_3)


